<script setup lang="ts">

import DetailHeader from "@/components/index/teacher/DetailHeader.vue";
import DetailSection from "@/components/index/teacher/DetailSection.vue";
import {useRoute} from "vue-router";
import {ref} from "vue";
import {teacherDetail} from "@/http/home";
import router from "@/router";

const route = useRoute()
const id = route.query.id
// console.log(id)

const teacherInformation = ref<object>({})

// 教师详情请求
teacherDetail(id).then(res => {
    // console.log(res)
    if (res.code==200){
        teacherInformation.value = res.data
    }else if (res.code==401){
        router.push('/denglu')
    }
    // console.log(teacherInformation.value)
})


//把教师详情数组传递给子组件
// const list = ref<any[]>(teacherDetailList.value)
// const list: any = teacherInformation.value
</script>

<template>
    <div>
        <detail-header :teacherInfo="teacherInformation"></detail-header>
        <detail-section :teacherInfo="teacherInformation"></detail-section>
    </div>
</template>

<style scoped>

</style>